import 'package:flutter/material.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBEngineer/YBBaseRouter/YBNavigator.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBColor/YBColor.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBImageStyle/YBImageStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';

import 'YBMapMiShuProvider/YBMapMiShuEventBus.dart';

class YBMapNinDeYuSuanPage extends StatelessWidget {

  TextEditingController _diEditeController = TextEditingController();

  TextEditingController _gaoEditeController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Scaffold(
        appBar: AppBar(
          elevation: 0,
          title: Text('您的预算'),
        ),
        body:Column(
          children: [
            Expanded(
              child: SingleChildScrollView(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Container(
                      child: Padding(
                        padding: EdgeInsets.only(left: 20,right: 20,top: 24),
                        child: Container(
                            child: Text('您的预算',style:YBTextStyle.TextStyle18181818Medium,)
                        ),
                      ),
                    ),
                    Container(
                      height: 24,
                    ),
                    Container(
                      child: Padding(
                        padding: EdgeInsets.only(left: 20,right: 20),
                        child: Container(
                          height: 44,
                          decoration: BoxDecoration(
                            borderRadius: BorderRadius.all(Radius.circular(8.0)),
                            color: YBColor.colorF0F2F5,
                          ),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.start,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              Container(
                                width: 12,
                              ),
                              Container(
                                child: Image.asset(YBImageStyle.getImagePath('lawyer_yusuanImage'),width: 16,height: 16,),
                              ),
                              Container(
                                width: 8,
                              ),
                              Expanded(
                                child: TextField(
                                  decoration: InputDecoration(
                                    hintText: "输入您最低预算",
                                    border: InputBorder.none,
                                  ),
                                  controller: _diEditeController,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                    ),
                    Container(
                      height: 16,
                    ),
                    Container(
                      child: Padding(
                        padding: EdgeInsets.only(left: 20,right: 20),
                        child: Container(
                          height: 44,
                          decoration: BoxDecoration(
                            borderRadius: BorderRadius.all(Radius.circular(8.0)),
                            color: YBColor.colorF0F2F5,
                          ),
                          child: Row(
                            children: [
                              Container(
                                width: 12,
                              ),
                              Container(
                                child: Image.asset(YBImageStyle.getImagePath('lawyer_yusuanImage'),width: 16,height: 16,),
                              ),
                              Container(
                                width: 8,
                              ),
                              Expanded(
                                child: TextField(
                                  decoration: InputDecoration(
                                    hintText: "输入您最高预算",
                                    border: InputBorder.none,
                                  ),
                                  controller: _gaoEditeController,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ),
            Container(
              height: 60,
              child: Padding(
                padding: EdgeInsets.only(left: 20,right: 20),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Expanded(
                      flex: 1,
                      child: Container(
                        height: 44,
                        child: OutlineButton(
                          shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.all(Radius.circular(8.0)),

                          ),
                          child: Text('清空',style: YBTextStyle.TextStyle64646416,),
                          onPressed: () async {
                            _diEditeController.text = "";
                            _gaoEditeController.text = '';
                          },
                        ),
                      ),
                    ),
                    Container(
                      width: 20,
                    ),
                    Expanded(
                      flex: 2,
                      child: Container(
                        height: 44,
                        child: RawMaterialButton(
                          shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.all(Radius.circular(4.0)),

                          ),
                          fillColor: YBColor.commonThemeColor,
                          child: Text('选好了',style: YBTextStyle.TextStyleFFFFFF16Medium,),
                          onPressed: () async {
                            eventBus.fire(YBMapMiShuYuSuanEventBus(_diEditeController.text, _gaoEditeController.text));
                            YBNavigatorUtil.goBack(context);
                          },
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
